home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 32 / Amiga Format AFCD32 (Nov 1998, Issue 117).iso / -seriously_amiga- / programming / basic / blitzc2p / c2p030only.ascii < prev    next >
Text File  |  1998-08-10  |  7KB  |  488 lines

  1. WBStartup
  2. NoCli
  3.  
  4. ; 030/50 results:
  5.  
  6. ; 320x200 @40.4fps PAL
  7. ; 320x256 @30.7fps PAL
  8. ; 320x200 @44.1fps PAL
  9. ; 320x256 @33.8fps PAL
  10.  
  11. ; 040/25 results:
  12.  
  13. ; 320x200 @42fps DoublePAL or 44fps PAL
  14. ; 320x256 @31fps DoublePAL or 34fps PAL
  15. ; 320x240 @33.6fps DoublePAL or 36.5fps PAL
  16.  
  17. #c2pBPLX=320
  18. #c2pBPLY=256
  19. #c2pBPLSIZE=(#c2pBPLX*#c2pBPLY)/8
  20.  
  21. #scrwidth=#c2pBPLX
  22. #scrheight=#c2pBPLY
  23. #screensize=#scrwidth*#scrheight
  24.  
  25. ; c2p1x1_8_c5
  26. ;
  27. ; 132% on 040-25
  28.  
  29. Statement c2p030onlyinit{A.l,B.l}
  30.  
  31.   ;A.l=d0=Width.w
  32.   ;B.l=d1=Height.w
  33.  
  34. ; d0.w  chunkyx [chunky-pixels]
  35. ; d1.w  chunkyy [chunky-pixels]
  36. ; d2.w  (scroffsx) [screen-pixels]
  37. ; d3.w  scroffsy [screen-pixels]
  38. ; d4.w  (rowlen) [bytes] -- offset between one row and the next in a bpl
  39. ; d5.l  (c2pBPLSIZE) [bytes] -- offset between one row in one bpl and the next bpl
  40.  
  41.   MOVEQ.l #0,d2
  42.   MOVEQ.l #0,d3
  43.   MOVE.l  #c2pBPLX/8,d4
  44.   MOVE.l  d4,d5
  45.   MULU    d1,d5
  46.  
  47.   LEA c2p_datanew(pc),a0
  48.   ANDI.l  #$ffff,d0
  49.   MULU.w  d0,d3
  50.   LSR.l #3,d3
  51.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  52.   MULU.w  d0,d1
  53.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  54. AsmExit
  55. End Statement
  56.  
  57. Statement c2p030only{A.l,B.l}
  58.  
  59.   MOVE.l  d0,a0 ; Chunky
  60.   MOVE.l  d1,a1 ; Planar
  61.  
  62. ; a0  c2pscreen
  63. ; a1  bitplanes
  64.  
  65. c2p1x1_8_c5
  66.   MOVEM.l a2-a6,-(a7)
  67.  
  68.   MOVEM.l a0-a1,-(a7)
  69.   LEA c2p_datanew,a0
  70.   LEA c2p_data,a1
  71.   MOVEQ #16-1,d0
  72. _copy: MOVE.l  (a0)+,(a1)+
  73.   DBF d0,_copy
  74.   MOVEM.l (a7)+,a0-a1
  75.  
  76.   LEA c2p_data(pc),a2
  77.  
  78.   MOVE.l  #$33333333,d5
  79.   MOVE.l  #$55555555,d6
  80.   MOVE.l  #$00ff00ff,a6
  81.  
  82.   ADD.w #c2pBPLSIZE,a1
  83.   ADD.l c2p_scroffs-c2p_data(a2),a1
  84.  
  85.   MOVE.l  c2p_pixels-c2p_data(a2),a2
  86.   ADD.l a0,a2
  87.   CMP.l a0,a2
  88.   BEQ _none
  89.  
  90.   MOVEM.l a0-a1,-(a7)
  91.  
  92.   MOVE.l  (a0)+,d0
  93.   MOVE.l  (a0)+,d2
  94.   MOVE.l  (a0)+,d1
  95.   MOVE.l  (a0)+,d3
  96.  
  97.   MOVE.l  #$0f0f0f0f,d4   ; Merge 4x1, part 1
  98.   AND.l d4,d0
  99.   AND.l d4,d2
  100.   LSL.l #4,d0
  101.   OR.l  d2,d0
  102.  
  103.   AND.l d4,d1
  104.   AND.l d4,d3
  105.   LSL.l #4,d1
  106.   OR.l  d3,d1
  107.  
  108.   MOVE.l  d1,a3
  109.  
  110.   MOVE.l  (a0)+,d2
  111.   MOVE.l  (a0)+,d1
  112.   MOVE.l  (a0)+,d3
  113.   MOVE.l  (a0)+,d7
  114.  
  115.   AND.l d4,d2     ; Merge 4x1, part 2
  116.   AND.l d4,d1
  117.   LSL.l #4,d2
  118.   OR.l  d1,d2
  119.  
  120.   AND.l d4,d3
  121.   AND.l d4,d7
  122.   LSL.l #4,d3
  123.   OR.l  d7,d3
  124.  
  125.   MOVE.l  a3,d1
  126.  
  127.   MOVE.w  d2,d7     ; Swap 16x2
  128.   MOVE.w  d0,d2
  129.   SWAP  d2
  130.   MOVE.w  d2,d0
  131.   MOVE.w  d7,d2
  132.  
  133.   MOVE.w  d3,d7
  134.   MOVE.w  d1,d3
  135.   SWAP  d3
  136.   MOVE.w  d3,d1
  137.   MOVE.w  d7,d3
  138.  
  139.   BRA _start1
  140. _x1
  141.   MOVE.l  (a0)+,d0
  142.   MOVE.l  (a0)+,d2
  143.   MOVE.l  (a0)+,d1
  144.   MOVE.l  (a0)+,d3
  145.  
  146.   MOVE.l  d7,c2pBPLSIZE(a1)
  147.  
  148.   MOVE.l  #$0f0f0f0f,d4   ; Merge 4x1, part 1
  149.   AND.l d4,d0
  150.   AND.l d4,d2
  151.   LSL.l #4,d0
  152.   OR.l  d2,d0
  153.  
  154.   AND.l d4,d1
  155.   AND.l d4,d3
  156.   LSL.l #4,d1
  157.   OR.l  d3,d1
  158.  
  159.   MOVE.l  d1,a3
  160.  
  161.   MOVE.l  (a0)+,d2
  162.   MOVE.l  (a0)+,d1
  163.   MOVE.l  (a0)+,d3
  164.   MOVE.l  (a0)+,d7
  165.  
  166.   MOVE.l  a4,(a1)+
  167.  
  168.   AND.l d4,d2     ; Merge 4x1, part 2
  169.   AND.l d4,d1
  170.   LSL.l #4,d2
  171.   OR.l  d1,d2
  172.  
  173.   AND.l d4,d3
  174.   AND.l d4,d7
  175.   LSL.l #4,d3
  176.   OR.l  d7,d3
  177.  
  178.   MOVE.l  a3,d1
  179.  
  180.   MOVE.w  d2,d7     ; Swap 16x2
  181.   MOVE.w  d0,d2
  182.   SWAP  d2
  183.   MOVE.w  d2,d0
  184.   MOVE.w  d7,d2
  185.  
  186.   MOVE.w  d3,d7
  187.   MOVE.w  d1,d3
  188.   SWAP  d3
  189.   MOVE.w  d3,d1
  190.   MOVE.w  d7,d3
  191.  
  192.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  193. _start1
  194.   MOVE.l  a6,d4
  195.  
  196.   MOVE.l  d2,d7     ; Swap 2x2
  197.   LSR.l #2,d7
  198.   EOR.l d0,d7
  199.   AND.l d5,d7
  200.   EOR.l d7,d0
  201.   LSL.l #2,d7
  202.   EOR.l d7,d2
  203.  
  204.   MOVE.l  d3,d7
  205.   LSR.l #2,d7
  206.   EOR.l d1,d7
  207.   AND.l d5,d7
  208.   EOR.l d7,d1
  209.   LSL.l #2,d7
  210.   EOR.l d7,d3
  211.  
  212.   MOVE.l  d1,d7
  213.   LSR.l #8,d7
  214.   EOR.l d0,d7
  215.   AND.l d4,d7
  216.   EOR.l d7,d0
  217.   LSL.l #8,d7
  218.   EOR.l d7,d1
  219.  
  220.   MOVE.l  d1,d7
  221.   LSR.l #1,d7
  222.   EOR.l d0,d7
  223.   AND.l d6,d7
  224.   EOR.l d7,d0
  225.   MOVE.l  d0,c2pBPLSIZE*2(a1)
  226.   ADD.l d7,d7
  227.   EOR.l d1,d7
  228.  
  229.   MOVE.l  d3,d1
  230.   LSR.l #8,d1
  231.   EOR.l d2,d1
  232.   AND.l d4,d1
  233.   EOR.l d1,d2
  234.   LSL.l #8,d1
  235.   EOR.l d1,d3
  236.  
  237.   MOVE.l  d3,d1
  238.   LSR.l #1,d1
  239.   EOR.l d2,d1
  240.   AND.l d6,d1
  241.   EOR.l d1,d2
  242.   ADD.l d1,d1
  243.   EOR.l d1,d3
  244.  
  245.   MOVE.l  d2,a4
  246.   MOVE.l  d3,a5
  247.  
  248.   CMPA.l  a0,a2
  249.   BNE _x1
  250.  
  251.   MOVE.l  d7,c2pBPLSIZE(a1)
  252.   MOVE.l  a4,(a1)+
  253.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  254.  
  255.   MOVEM.l (a7)+,a0-a1
  256.   ADD.l #c2pBPLSIZE*4,a1
  257.  
  258.   MOVE.l  (a0)+,d0
  259.   MOVE.l  (a0)+,d2
  260.   MOVE.l  (a0)+,d1
  261.   MOVE.l  (a0)+,d3
  262.  
  263.   MOVE.l  #$f0f0f0f0,d4   ; Merge 4x1, part 1
  264.   AND.l d4,d0
  265.   AND.l d4,d2
  266.   LSR.l #4,d2
  267.   OR.l  d2,d0
  268.  
  269.   AND.l d4,d1
  270.   AND.l d4,d3
  271.   LSR.l #4,d3
  272.   OR.l  d3,d1
  273.  
  274.   MOVE.l  d1,a3
  275.  
  276.   MOVE.l  (a0)+,d2
  277.   MOVE.l  (a0)+,d1
  278.   MOVE.l  (a0)+,d3
  279.   MOVE.l  (a0)+,d7
  280.  
  281.   AND.l d4,d2     ; Merge 4x1, part 2
  282.   AND.l d4,d1
  283.   LSR.l #4,d1
  284.   OR.l  d1,d2
  285.  
  286.   AND.l d4,d3
  287.   AND.l d4,d7
  288.   LSR.l #4,d7
  289.   OR.l  d7,d3
  290.  
  291.   MOVE.l  a3,d1
  292.  
  293.   MOVE.w  d2,d7     ; Swap 16x2
  294.   MOVE.w  d0,d2
  295.   SWAP  d2
  296.   MOVE.w  d2,d0
  297.   MOVE.w  d7,d2
  298.  
  299.   MOVE.w  d3,d7
  300.   MOVE.w  d1,d3
  301.   SWAP  d3
  302.   MOVE.w  d3,d1
  303.   MOVE.w  d7,d3
  304.  
  305.   BRA _start2
  306. _x2
  307.   MOVE.l  (a0)+,d0
  308.   MOVE.l  (a0)+,d2
  309.   MOVE.l  (a0)+,d1
  310.   MOVE.l  (a0)+,d3
  311.  
  312.   MOVE.l  d7,c2pBPLSIZE(a1)
  313.  
  314.   MOVE.l  #$f0f0f0f0,d4   ; Merge 4x1, part 1
  315.   AND.l d4,d0
  316.   AND.l d4,d2
  317.   LSR.l #4,d2
  318.   OR.l  d2,d0
  319.  
  320.   AND.l d4,d1
  321.   AND.l d4,d3
  322.   LSR.l #4,d3
  323.   OR.l  d3,d1
  324.  
  325.   MOVE.l  d1,a3
  326.  
  327.   MOVE.l  (a0)+,d2
  328.   MOVE.l  (a0)+,d1
  329.   MOVE.l  (a0)+,d3
  330.   MOVE.l  (a0)+,d7
  331.  
  332.   MOVE.l  a4,(a1)+
  333.  
  334.   AND.l d4,d2     ; Merge 4x1, part 2
  335.   AND.l d4,d1
  336.   LSR.l #4,d1
  337.   OR.l  d1,d2
  338.  
  339.   AND.l d4,d3
  340.   AND.l d4,d7
  341.   LSR.l #4,d7
  342.   OR.l  d7,d3
  343.  
  344.   MOVE.l  a3,d1
  345.  
  346.   MOVE.w  d2,d7     ; Swap 16x2
  347.   MOVE.w  d0,d2
  348.   SWAP  d2
  349.   MOVE.w  d2,d0
  350.   MOVE.w  d7,d2
  351.  
  352.   MOVE.w  d3,d7
  353.   MOVE.w  d1,d3
  354.   SWAP  d3
  355.   MOVE.w  d3,d1
  356.   MOVE.w  d7,d3
  357.  
  358.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  359. _start2
  360.   MOVE.l  a6,d4
  361.  
  362.   MOVE.l  d2,d7     ; Swap 2x2
  363.   LSR.l #2,d7
  364.   EOR.l d0,d7
  365.   AND.l d5,d7
  366.   EOR.l d7,d0
  367.   LSL.l #2,d7
  368.   EOR.l d7,d2
  369.  
  370.   MOVE.l  d3,d7
  371.   LSR.l #2,d7
  372.   EOR.l d1,d7
  373.   AND.l d5,d7
  374.   EOR.l d7,d1
  375.   LSL.l #2,d7
  376.   EOR.l d7,d3
  377.  
  378.   MOVE.l  d1,d7
  379.   LSR.l #8,d7
  380.   EOR.l d0,d7
  381.   AND.l d4,d7
  382.   EOR.l d7,d0
  383.   LSL.l #8,d7
  384.   EOR.l d7,d1
  385.  
  386.   MOVE.l  d1,d7
  387.   LSR.l #1,d7
  388.   EOR.l d0,d7
  389.   AND.l d6,d7
  390.   EOR.l d7,d0
  391.   MOVE.l  d0,c2pBPLSIZE*2(a1)
  392.   ADD.l d7,d7
  393.   EOR.l d1,d7
  394.  
  395.   MOVE.l  d3,d1
  396.   LSR.l #8,d1
  397.   EOR.l d2,d1
  398.   AND.l d4,d1
  399.   EOR.l d1,d2
  400.   LSL.l #8,d1
  401.   EOR.l d1,d3
  402.  
  403.   MOVE.l  d3,d1
  404.   LSR.l #1,d1
  405.   EOR.l d2,d1
  406.   AND.l d6,d1
  407.   EOR.l d1,d2
  408.   ADD.l d1,d1
  409.   EOR.l d1,d3
  410.  
  411.   MOVE.l  d2,a4
  412.   MOVE.l  d3,a5
  413.  
  414.   CMPA.l  a0,a2
  415.   BNE _x2
  416.  
  417.   MOVE.l  d7,c2pBPLSIZE(a1)
  418.   MOVE.l  a4,(a1)+
  419.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  420.  
  421. _none
  422.   MOVEM.l (a7)+,a2-a6
  423. AsmExit
  424.  
  425.   Even4
  426. c2p_data
  427. c2p_scroffs: Dc.l 0
  428. c2p_pixels: Dc.l 0
  429.   Ds.l  16
  430.   Even4
  431. c2p_datanew
  432.   Ds.l  16
  433. End Statement
  434.  
  435.  
  436.  
  437.  
  438. .blitzprogram
  439. ; Setup
  440. InitBank 0,(#scrwidth*#scrheight)+1000,2|65536 ; Chipram planar buffer
  441. CludgeBitMap 0,#scrwidth,#scrheight,8,Bank(0)
  442. InitPalette 0,256
  443. For c=0 To 255
  444.   AGAPalRGB 0,c,Rnd(c),Rnd(c),Rnd(c)
  445. Next c
  446. AGAPalRGB 0,0,0,0,0
  447. Screen 0,0,0,#scrwidth,#scrheight,8,0,"c2p test",0,0,0
  448. Use Palette 0
  449. VWait 50
  450. baseaddress1.l=AllocMem(#scrwidth*#scrheight,$10000) ; Fastram chunky buffer
  451.  
  452. ; Put something into the chunky buffer so we can see it working
  453. GetReg a0,baseaddress1
  454. MOVE.l  #0,d0
  455. MOVE.l  #screensize-1,d1
  456. cloop
  457.   MOVE.b  d0,(a0)+
  458.   ADDQ.l  #1,d0
  459.   SUBQ.l  #1,d1
  460.   TST.l   d1
  461.   BLT     done
  462.   BRA     cloop
  463. done
  464.  
  465. ; Do the c2p test
  466. c2p030onlyinit{#scrwidth,#scrheight}
  467. VWait 20
  468. Forbid_
  469. VWait
  470. ResetTimer
  471. For time=1 To 800
  472.   c2p030only{baseaddress1,Bank(0)} ; Convert chunky to planar
  473. Next time
  474. t=Ticks
  475. VWait 2 : Permit_
  476. VWait 20
  477. FindScreen 0
  478. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  479. WindowOutput 0
  480. NPrint "Routine performed @ ",50/(t/800),"fps - ",t," ticks"
  481. NPrint " "
  482. NPrint "Press mousebutton..."
  483. Free Screen 0
  484. MouseWait
  485. Free Window 0
  486. End
  487.  
  488.